package com.xiaoma.pattern.proxy.jdk1;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>Title: ILoginServiceImpl </p>
 * <p>Description：描述 </p>
 * <p>Package:com.xiaoma.pattern.proxy.jdk1 </p>
 * Date: 2022/5/26 12:27
 *
 * @author maj
 * @version 1.0.0
 */
public class ILoginServiceImpl implements ILoginService {

    private String USER_NAME_KEY = "username";
    private String PASSWORD_KEY = "password";
    private String username="Tony";
    private String password="123456";
    private Map<String,Object> resultMap;

    @Override
    public Map<String,Object> login(Map<String,Object> loginInfo) {
        resultMap  = new HashMap<>(1);
        if(loginInfo.get(USER_NAME_KEY).equals(username)&&loginInfo.get(PASSWORD_KEY).equals(password)) {
            resultMap.put("code",200);
            resultMap.put("msg","登录成功");
        }else {
            resultMap.put("code",401);
            resultMap.put("msg","登录失败");
        }
        return resultMap;
    }
}
